package com.gxa.admin.config;

import com.gxa.admin.constants.SecurityConstants;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @deprecated 在SecurityConfig类中管理跨域配置 -> SecurityConstants
 * @see SecurityConstants
 * @see SecurityConfig
 * @author lch
 * @date 2024/3/20 15:50
 * @description 跨域问题
 **/
//@Configuration
public class CorsConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                //.allowedOriginPatterns("*")
                .allowCredentials(true)
                .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
                .maxAge(3600);
    }
}